CURL_SRCS	:= curl_gethtml_test.c curl_savehtml_test.c curl_httpheader_test.c curl_proxy_test.c
CURL_TARGET := $(basename $(CURL_SRCS))
CURL_CFLAGS	:= -I. -I/home/qjn/src/opensource/curl-7.37.1/include/ -Werror -Wall
CURL_LFLAGS	:= -L/home/qjn/src/opensource/curl-7.37.1/lib -lcurl

MD5_SRCS	:= md5_openssl_test.c
MD5_TARGET	:= $(basename $(MD5_SRCS))
MD5_CFLAGS	:= -Werror -Wall
MD5_LFLAGS	:= -lssl

JSON_SRCS	:= jsonc_test.c
JSON_TARGET	:= $(basename $(JSON_SRCS))
JSON_CFLAGS	:= -I. -I/home/qjn/src/opensource/json-c/ -Werror -Wall
JSON_LFLAGS	:= -ljson-c -L/home/qjn/src/opensource/json-c/.libs/

GETRES_SRCS	:= get_resource_list.c
GETRES_TARGET	:= $(basename $(GETRES_SRCS))
GETRES_CFLAGS	:= -I. -I/home/qjn/src/opensource/curl-7.37.1/lib -I/home/qjn/src/opensource/json-c/ -Werror -Wall
GETRES_LFLAGS	:= -lcurl -ljson-c

OBJS		:= $(SRCS:.c:.o)
TARGET		:= $(CURL_TARGET) $(MD5_TARGET) $(JSON_TARGET) $(GETRES_TARGET)

all: $(TARGET)
curl_test: $(CURL_TARGET)
md5_test: $(MD5_TARGET)
json_test: $(JSON_TARGET)
getres: $(GETRES_TARGET)

$(CURL_TARGET): $(CURL_SRCS)
	$(CC) $(CURL_CFLAGS) $(CURL_LFLAGS) $@.c -o $@

$(MD5_TARGET): $(MD5_SRCS)
	$(CC) $(MD5_CFLAGS) $(MD5_LFLAGS) $(MD5_SRCS) -o $@

$(JSON_TARGET): $(JSON_SRCS)
	$(CC) $(JSON_CFLAGS) $(JSON_LFLAGS) $(JSON_SRCS) -o $@

$(GETRES_TARGET): $(GETRES_SRCS)
	$(CC) $(GETRES_CFLAGS) $(GETRES_LFLAGS) $(GETRES_SRCS) -o $@

clean:
	rm -rf $(TARGET) *.o

.PHONY:
	all $(TARGET)
